package com.tc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tc.bean.OBJECT_T_MALL_ATTR;
import com.tc.mapper.AttrMapper;
@Service
public class AttrServiceImpl implements AttrServiceInf{
	
	@Autowired
	AttrMapper attrMapper;
	
	@Override
	public List<OBJECT_T_MALL_ATTR> get_attr_list(int flbh2) {
		List<OBJECT_T_MALL_ATTR> list_attr = attrMapper.select_attr_list(flbh2);
		return list_attr;
	}

	/* 保存属性名 及其属性值
	 * @see com.tc.service.AttrServiceInf#save_attr(int, java.util.List)
	 */
	@Override
	public void save_attr(int flbh2, List<OBJECT_T_MALL_ATTR> list_attr) {
		for(OBJECT_T_MALL_ATTR oBJECT_T_MALL_ATTR:list_attr) {
			attrMapper.insert_attr(flbh2, oBJECT_T_MALL_ATTR);
			int attr_id = oBJECT_T_MALL_ATTR.getId();
			attrMapper.insert_values(attr_id, oBJECT_T_MALL_ATTR.getList_value());
		}
	}
	
}
